package SEApp.dialogs
{
	import SEApp.se_util;
	
	import UIFree.components.uif_window;
	import UIFree.uif_component;
	
	import flash.events.Event;
	import flash.events.EventDispatcher;
	import flash.events.MouseEvent;
	import flash.geom.Rectangle;

	public class se_alert extends se_buttonDialog {
		protected var _desc		: Object;
		
		public static const ALERT: String = 'ALERT';
		
		public function se_alert(parent:uif_component, message: String, 
								closeFunc: Function=null, 
								cancelButton: Boolean = false,
								a_width: Number = 400,
								a_height: Number = 200) {
			super(parent, 0, 0, a_width, a_height, true);
			var inner: Rectangle = getInner();
			_desc = new app.classes['textArea'](this, inner.x, inner.y, inner.width, 20, 'description');
			_desc.htmlText = message;
			inner = resizeFromText();
			toCenter(app);
			createButtons(closeFunc, cancelButton);
		}
		
		protected function resizeText(): void {
			var set_h	: int = _desc.textField.textHeight + _desc.getSpace(true) * 2;
			var maxH	: int = parent.height - getSpace(true) * 2 - 80;
			if (set_h > maxH) set_h = maxH;
			 
			_desc.textField.height = set_h;
			_desc.height = set_h;
		}
		
		protected function resizeFromText(): Rectangle {
			resizeText();
			height = _desc.y + _desc.height + getSpace(true) + 40; 
			return getInner();
		}
	}
}